/**切换批次导入时间**/
function custScreenTime(btn) {
    var data_cliak = $(btn).attr("data-click");
    if(data_cliak === "selft"){
        $("#Screen-daterange").removeClass("hidden");
        $("#screestarttime").val(moment().subtract("days",29).format("YYYY-MM-DD"));
        $("#screeendtime").val(moment().format("YYYY-MM-DD"));
    }else{
        $("#Screen-daterange").addClass("hidden");
        $("#screestarttime").val('')
        $("#screeendtime").val('');
    }
    $("#custScreenTime").find("button").each(function () {
        $(this).removeClass("btn-primary");
    });
    $(btn).addClass("btn-primary");
    //动态加载
    //@TODO
    $JuXue.refreshTable("bigEmpIpTable");
}

/**导出状态**/
function custScreenExport(btn) {
    $("#custScreenover").find("button").each(function () {
        $(this).removeClass("btn-primary");
    });
    $(btn).addClass("btn-primary");
    var over = $(btn).attr("data-click");
    $("#custScreenoverInput").val(over);
    //动态加载
    $JuXue.refreshTable("bigEmpIpTable");
}

/**加载导出详情**/
function viewIpRecoredDetail(btn){
    var selectids = $(btn).attr("data-click");
    if (selectids== undefined){$JuXue.n_warning("请重新选择导出批次");return}
    $("#selectExport").val(selectids);
    $.post(ctx+"bigScreen/exportDetail",{},function (r) {
        $("#export-detail-div").empty().append(r).modal("show").draggable();
    });
}

/**加载导入详情信息**/
function viewEpRecoredDetail(btn) {
    var selectids = $(btn).attr("data-click");
    if (selectids== undefined){$JuXue.n_warning("请重新选择导出批次");return}
    $("#selectExport").val(selectids);
    $.post(ctx+"bigScreen/importDetail",{},function (r) {
        $("#export-detail-div").empty().append(r).modal("show").draggable();
    });
}
/**忽略当前批次信息**/
function ignoreCurentBatchCus(btn) {
    var selectids = $(btn).attr("data-click");
    if (selectids== undefined){$JuXue.n_warning("请重新选择导出批次");return}

    $JuXue.confirm({
        text: "确定忽略当前导出记录的用户？",
        confirmButtonText: "确定忽略"
    }, function() {
        $.post(ctx + 'bigScreen/updateExportbatchRecord', { "cIpId": selectids,"cIpStatus":"2" }, function(r) {
            if (r.code === 0) {
                $JuXue.n_success(r.msg);
                $JuXue.refreshTable("bigEmpIpTable");
            } else {
                $JuXue.n_danger(r.msg);
            }
        });
    });
}
/**结算当前导出批次的信息**/
function setImCurentBatchCus(btn) {
    var selectids = $(btn).attr("data-click");
    if (selectids== undefined){$JuXue.n_warning("请重新选择导出批次");return}
    $JuXue.confirm({
        text: "确定结算当前导出记录的用户？",
        confirmButtonText: "确定结算"
    }, function() {
        $.post(ctx + 'bigScreen/updateExportbatchRecord', { "cIpId": selectids,"cIpIsover":"1" }, function(r) {
            if (r.code === 0) {
                $JuXue.n_success(r.msg);
                $JuXue.refreshTable("bigEmpIpTable");
            } else {
                $JuXue.n_danger(r.msg);
            }
        });
    });
}

/**导出当前导出批次的客户**/
function exportCurentBatchCus(btn) {
    var selectids = $(btn).attr("data-click");
    if (selectids== undefined){$JuXue.n_warning("请重新选择导出批次");return}
    $JuXue.confirm({
        text: "确定导出当前导出记录的客户(只能导出一次)？",
        confirmButtonText: "确定导出"
    }, function() {
        $.post(ctx + 'bigScreen/exportBigEmpExcel', { "kid": selectids }, function(r) {
            if (r.code === 0) {
                window.location.href = "file/download?fileName=" + r.msg + "&delete=" + true;
                $JuXue.refreshTable("bigEmpIpTable");
            } else {
                $JuXue.n_warning(r.msg);
            }
        });
    });
}
/**恢复当前批次**/
function recoverCurentBatchCus(btn) {
    var selectids = $(btn).attr("data-click");
    if (selectids== undefined){$JuXue.n_warning("请重新选择导出批次");return}
    $JuXue.confirm({
        text: "确定恢复当前导出记录的客户？",
        confirmButtonText: "确定导出"
    }, function() {
        $.post(ctx + 'bigScreen/updateExportbatchRecord', { "cIpId": selectids,"cIpStatus":"0" }, function(r) {
            if (r.code === 0) {
                $JuXue.n_success(r.msg);
                $JuXue.refreshTable("bigEmpIpTable");
            } else {
                $JuXue.n_warning(r.msg);
            }
        });
    });
}



